package com.elf.zero.step;

import android.content.Context;

import com.elf.zero.utils.DateTimeUtils;
import com.elf.zero.utils.FileUtils;
import com.elf.zero.utils.LogUtils;

import java.io.File;
import java.io.IOException;

public class Step {

    public static void init(Context context) {
        StepConfigManger.init(context);
        StepDataBase.init(context);
    }

    public static void writeLog(String msg) {
        try {
            LogUtils.i("step", msg);
            String content = DateTimeUtils.getCurrentDateTime() + ":" + msg + "\n";
            String fileName = "step_log_" + DateTimeUtils.getCurrentDate() + ".txt";
            FileUtils.saveFile(content, new File(FileUtils.getCacheDir(), fileName), true);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
